<script type="text/javascript" src="<?=base_url()?>resource/plugins/My97DatePicker/WdatePicker.js"></script>
<!--菜单 start-->
<?php $this->load->view('defaults/common/left');?>
<!--菜单 end-->
<div id="content">
    <div class="page-header">
        <div class="container-fluid">
          <h1>订单管理</h1>
          <?=$this->breadcrumb->generateHTML();?>
        </div>
    </div>
    <div class="container-fluid">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title"><i class="fa fa-list"></i> <?=lang('order_ddlb')?></h3>
            </div>
            <div class="panel-body">
                <div class="well" style="padding:0 19px;">
                  <div class="row">
                    <form action="<?=blang_url('orders/order/')?>" method="post" name="searchform">
                        <div class="col-sm-3">
                        <div class="form-group">
                            <label class="control-label"><?=lang('public_zdyss')?></label>
                            <select class="form-control" name="diyKeyword">
                                <option value="" >--<?=lang('public_qxz')?>--</option>
                                <?php foreach ($diySerachFields as $key=>$val):?>
                                    <option value="<?=$key?>" <?=$optKeyword[$key]?> >
                                        <?=$val?>
                                    </option>
                                <?php endforeach;?>
                            </select>
                        </div>
                        <div class="form-group">
                            <label class="control-label"><?=lang('public_zdyssz')?></label>
                            <input class="form-control" name="diyValue" value="<?=$diyValue?>" placeholder="<?=lang('public_qsrz')?>" />
                        </div>
                        <div class="form-group">
                            <label class="control-label"><?=lang('order_wxzd')?></label>
                            <select class="form-control" name="repair_site_id">
                                <option value="" >--<?=lang('public_qxz')?>--</option>
                                <?php foreach ($repairSiteList as $rs):?>
                                    <option value="<?=$rs['id']?>"
                                        <?=$optRepairSite[$rs['id']]?> >
                                        <?=$rs['site_name']?>
                                    </option>
                                <?php endforeach;?>
                            </select>
                        </div>
                        </div>
                        <div class="col-sm-3">
                        <div class="form-group">
                            <label class="control-label">website_origin</label>
                            <select class="form-control" name="website_origin">
                                <option value="" >--<?=lang('public_qxz')?>--</option>
                                <?php foreach ($originList as $key=>$val):?>
                                    <option value="<?=$key?>"
                                        <?=$optOrigin[$key]?> >
                                        <?=$val?>
                                    </option>
                                <?php endforeach;?>
                            </select>
                        </div>
                        <div class="form-group">
                            <label class="control-label"><?=lang('order_dhly')?></label>
                            <select class="form-control" name="source_site_id">
                                <option value="" >--<?=lang('public_qxz')?>--</option>
                                <?php foreach ($siteList as $rs):?>
                                    <option value="<?=$rs['source_site_id']?>"
                                        <?=$optSite[$rs['source_site_id']]?> >
                                        <?=$rs['source_site']?>
                                    </option>
                                <?php endforeach;?>
                            </select>
                        </div>
                        <div class="form-group">
                            <label class="control-label"><?=lang('order_wxlx')?></label>
                            <select class="form-control" name="maintain_type_id">
                                <option value="" >--<?=lang('public_qxz')?>--</option>
                                <?php foreach ($repairTypeList as $rs):?>
                                    <option value="<?=$rs['maintain_type_id']?>"
                                        <?=$optRepairType[$rs['maintain_type_id']]?> >
                                        <?=$rs['maintain_type_name']?>
                                    </option>
                                <?php endforeach;?>
                            </select>
                        </div>
                        </div>
                        <div class="col-sm-3"> 
                            <div class="form-group">
                                <label class="control-label"><?=lang('order_xzsjlx')?></label>
                                <select class="form-control" name="timeType">
                                    <option value="" >--<?=lang('public_qxz')?>--</option>
                                    <option value="0" ><?=lang('public_cjrq')?></option>
                                    <option value="1" >Update Date</option>
                                </select> 
                            </div>
                            <div class="form-group">
                                <label class="control-label"><?=lang('order_kssj')?></label>
                                <input type="text" name="startTime" value="<?=$startTime?>" placeholder="<?=lang('public_qsrz')?>" onfocus="WdatePicker({lang:'en'})" class="form-control Wdate" />
                            </div>
                            <div class="form-group">
                                <label class="control-label"><?=lang('order_jssj')?></label>
                                <input type="text" name="endTime" value="<?=$endTime?>" placeholder="<?=lang('public_qsrz')?>" onfocus="WdatePicker({lang:'en'})" class="form-control Wdate" />
                            </div>
                        </div>
                        <div class="col-sm-3">
                        <div class="form-group">
                                <label class="control-label"><?=lang('order_ddzt')?></label>
                                <select class="form-control" name="status_id" id="statusId">
                                    <option value="" >--<?=lang('public_qxz')?>--</option>
                                    <?php foreach ($statusList as $rs):?>
                                        <option value="<?=$rs['status_id']?>" <?=$optStatus[$rs['status_id']]?> > <?=$rs['status_name']?> </option>
                                    <?php endforeach;?>
                                </select>
                            </div>
                            
                            <input type="submit" name="searchSubmit" class="btn btn-primary pull-right" style="margin: 0 0 10px 10px;" value="<?=lang('public_cx')?> " />
                            <a href="<?=$outputUrl?>" class="btn btn-oms pull-right"><i class="fa fa-download"></i>&nbsp;<?=lang('public_dcsj')?></a>
                        </div>
                    </form>
                  </div>
                </div>
                <div class="table-responsive">
                    <table class="table table-bordered table-hover oms-table">
                      <thead>
                        <tr>
                          <td class="text-left"><?=lang('order_wxdh')?></td>
                          <td class="text-left"><?=lang('order_dhly')?></td>
                          <td class="text-left"><?=lang('order_lydh')?></td>
                          <td class="text-left"><?=lang('order_wxlx')?></td>
                          <td class="text-right"><?=lang('public_zt')?></td>
                          <td class="text-right"><?=lang('public_cjrq')?></td>
                          <td class="text-right"><?=lang('order_clr')?></td>
                          <td class="text-right" style="width:15%;"><?=lang('public_cz')?></td>
                        </tr>
                      </thead>
                      <tbody>
                        <?php if($dataList): foreach ($dataList as $key=>$rs):?>
                        <tr>
                            <td class="text-left"><?=$rs['id']?></td>
                            <td class="text-left"><?=$rs['siteName']?></td>
                            <td class="text-left"><?=$rs['source_int_id']?></td>
                            <td class="text-left"><?=$rs['repairName']?></td>
                            <td class="text-right"><?=$rs['statusName']?></td>
                            <td class="text-right" title="<?=$rs['enter_time']?>" ><?=$rs['add_time']?></td>
                            <td class="text-right"><?=$rs['operator']?></td>
                            <td class="text-right">
                                <a class="btn btn-primary btn-sm" href="<?=blang_url('orders/order/inDetails/'.$rs['id'].'/'.$page)?>"><?=lang('public_ckxq')?></a>
                                <a class="btn btn-primary btn-sm" href="<?=blang_url('orders/order/edit/'.$rs['id'].'/'.$page)?>" title="<?=lang('public_editText')?>"><i class="fa fa-edit"></i></a>
                                <?php if($rs['is_add_cp']===true):?>
                                <a class="btn btn-primary btn-sm" href="<?=blang_url('products/product/add/'.$rs['id'])?>" title="<?=lang('product_tjcp')?>"><i class="fa fa fa-plus"></i></a>
                                <?php endif;?>
                                <a class="btn btn-danger btn-sm" href="<?=blang_url('orders/order/del/'.$rs['id'].'/'.$page)?>" onclick="return confirm('<?=lang('public_isdel')?>')" title="<?=lang('public_sc')?>"><i class="fa fa-trash-o"></i></a>
                                <?php if($rs['status_id']>=2): ?>
                                <a class="btn btn-primary btn-sm" href="<?=blang_url('orders/order/syncQcReport/'.$rs['id'])?>" ><?=lang('order_tszjbg')?></a>
                                <?php endif; ?>

                                <?php if($rs['status_id']>=4): ?>
                                <a class="btn btn-primary btn-sm" href="<?=blang_url('orders/order/syncPriceOne/'.$rs['id'])?>" ><?=lang('order_tsbjd')?></a>
                                <?php endif; ?>

                                <?php if($rs['maintain_type_id']==8): ?>
                                <a class="btn btn-primary btn-sm" href="<?=blang_url('orders/mgbarcode/addBarcode/'.$rs['id'])?>" >print barcode</a>
                                <?php endif; ?>

                            </td>
                        </tr>
                        <?php endforeach; else:?>
                            <tr><th colspan="8" class="emptyNumber"><?=lang('public_mygdsj')?>....</th></tr>
                        <?php endif; ?>
                    </tbody>
                    </table>
                    <?php if($show_pages):?>
                    <div class="page">
                        <?=$show_pages?>
                    </div>
                    <?php endif;?>
                </div>
            </div>
        </div>
    </div>
</div>